home *** CD-ROM | disk | FTP | other *** search
- Path: news.compuserve.com!newsmaster
- From: 100435.736@compuserve.com (David A. Mair)
- Newsgroups: comp.lang.c
- Subject: Re: How to Call Windows API from DOS app.
- Date: Mon, 01 Apr 1996 09:55:21 GMT
- Organization: CompuServe Incorporated
- Message-ID: <4jo5pa$srl@dub-news-svc-3.compuserve.com>
- References: <3159E0E6.1363@central.gvrd.bc.ca>
- NNTP-Posting-Host: dd35-167.compuserve.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- Jay Toor <JTOOR@central.gvrd.bc.ca> wrote:
-
- >Anyone have any ideas how I can call functions like,
-
- >GetPrivateProfileString and WritePrivateProfileString from
- >a DOS C program?
-
- >Is this possible?
-
- Jay,
-
- I've always cooked my own, they're not all that complicated. I
- optimise them by making the assumption that .INI files are small (16
- bit Windows has a limit of 64kB on them). I get the file size,
- allocate that amount of memory and read the entire file into memory
- with one operation (much faster than string reads). I then build a
- string containing the section name surrounded by square brackets and
- search the memory block for it. I then search for the next open
- square brackets at the start of a line and I have the star and end
- addresses of the section. I search these limits for the item name
- followed by an equals sign and return everything after the equals to
- the end of the line into the user supplied buffer and free the .INI
- file memory block.
-
- Regards
- David.
-
-